package com.weimei.conversionTreasure.viewModel;

import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;

import com.weimei.conversionTreasure.activity.MonthDetailActivity;
import com.weimei.conversionTreasure.activity.YearDetailActivity;
import com.weimei.conversionTreasure.http.entity.YearBean;

import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.base.ItemViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;

public class TotalYItemVM extends ItemViewModel {

    public ObservableField<YearBean.DataDTO.MlistDTO> entity = new ObservableField<>();
    public ObservableField<String> type = new ObservableField<>("");

    public TotalYItemVM(@NonNull BaseViewModel viewModel, YearBean.DataDTO.MlistDTO data) {
        super(viewModel);
        entity.set(data);
    }

    public BindingCommand itemClick = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            Bundle bundle = new Bundle();
            bundle.putString("time",entity.get().getMonth());
            bundle.putString("type",type.get());
            viewModel.startActivity(YearDetailActivity.class,bundle);
        }
    });

    public void setTime(String types) {
        type.set(types);
    }
}
